//
//  PhototViewController.m
//  卢卡的时光网
//
//  Created by 卡神 on 15/7/23.
//  Copyright © 2015年 lok. All rights reserved.
//

#import "PhototViewController.h"

@interface PhototViewController ()

@end

@implementation PhototViewController


- (void)viewDidLoad {
    [super viewDidLoad];
    [self _createPhotoCollectionView];
    [self _createNavigationBar];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(hiddenTabBar) name:@"HiddenTabBarNotification" object:nil];

    // Do any additional setup after loading the view.
}

- (void)hiddenTabBar {
    NSLog(@"1");
    BOOL isHidden = self.navigationController.navigationBar.isHidden;
    [self.navigationController setNavigationBarHidden:!isHidden animated:YES];
    
}

- (void)_createPhotoCollectionView {
    UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
    layout.itemSize = self.view.bounds.size;
    layout.minimumInteritemSpacing = 0;
    layout.minimumLineSpacing = 0;
    layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
    _photoCollectionView.backgroundColor = [UIColor redColor];
    _photoCollectionView = [[PhotoCollectionView alloc] initWithFrame:self.view.bounds collectionViewLayout:layout];
    _photoCollectionView.pagingEnabled = YES;
    
    [self.view addSubview:_photoCollectionView];
}

- (void)setCurrentImage:(NSInteger)currentImage {
    _currentImage = currentImage;
    _photoCollectionView.currentImage = _currentImage;
}

- (void)_createNavigationBar {
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"取消" style:UIBarButtonItemStylePlain target:self action:@selector(goBack)];
}

- (void)setImageUrl:(NSMutableArray *)imageUrl {
    _imageUrl = imageUrl;
    _photoCollectionView.imageUrl = _imageUrl;
}

- (void)goBack {
    [self dismissViewControllerAnimated:YES completion:nil];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
